From: arstokke@sn.no (Petter E. Stokke)
Subject: Re: MUII_StringBack
To: mui@sunsite.Informatik.RWTH-Aachen.DE (mui)
In-Reply-To: 
Message-Id: <1331.6661T73T545@sn.no>
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Mailer: THOR 2.22 (Amiga;TCP/IP)
Lines: 35
Resent-Message-Id: <"cIQKe2.0.hq2.zRiMn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/826
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
X-Lines: 36
Status: RO
Content-Type: text/plain; charset="us-ascii"
Content-Length: 1332


On 11-Mar-96 13:28:55, Dirk Holtwick 
wrote:

>c)  Another  question, that may not fit into this list, but I don't
>know  how  to  play  a  sound  sample  with  datatypes.  I have the
>autodocs,  but no further documentation of the os3.1 and so I think
>this  forum  is the only place to get a good answer.  I want to use
>it  in a vocabulary tool (/misc/edu/dito.lha) to enable the user to
>listen to vocabularies.

Yep, it's quite as simple as this (assuming datatypes.library is opened):

void playdatatype(char* name)
{
    APTR obj;

    obj = NewDTObject(name,DTA_GROUPID,GID_SOUND,TAG_DONE);
    if (!obj) return;
    DoDTMethod(obj,NULL,NULL,DTM_TRIGGER,NIL,STM_PLAY,TAG_DONE);
    DisposeDTObject(obj);
}

Hope this works, it's been a while since I programmed in C... But you get
the general idea anyway, I hope.


From: "Stefan Stuntz" 
Date:   Sat, 17 Feb 1996 10:47:53 +0100
X-Mailer: IntuiNews 1.3b Beta 5 (3.1.96)
Subject: Re: MUI bitmaps and images.
Message-Id: <81319350@magic.informatik.tu-muenchen.de>
Organization: Home of MUI
Resent-Message-Id: <"HpDuI3.0.097.EJQ9n"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/334
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 2444
X-Lines: 82
Status: RO

Damon Davies wrote in article <845.6620T634T2471@manawatu.gen.nz>:

> I need to use the features of both the Image class and the Bitmap class. I
> want to load a picture with the image class using the tag MUIA_Image_Spec,
> but I would also like access to the graphic data as a bitmap, I assumed
> that BitMap class was a subclass of Image class so I would be able to load
> a picture with the features of Image class but still maintain the
> flexibility of the tag MUIA_Bitmap_RemappedBitmap plus a few  more, this
> does not seem an unreasonable way of implementing the classes, yet it
> didn't work for me. Maybe there is an illegal way of getting a pointer to
> the image bitmap? as I will not be publishing my project, and using an image
> class, will save me a lot of headaches over implementing the datatypes code
> myself.

Datatypes really are not that difficult to use...


static struct MUI_Image *CreateAlienImage(struct MUI_RenderInfo *mri,char *spec,ULONG flags)
{
        struct AlienImage *img;
        struct Library *DataTypesBase;
        BOOL remap = TRUE;

        if (DataTypesBase = OpenLibrary("datatypes.library",39))
        {
                if (img = AllocImage(sizeof(struct AlienImage),spec))
                {
                        struct Process *myproc = (struct Process *)FindTask(NULL);
                        APTR oldwindowptr = myproc->pr_WindowPtr;

                        myproc->pr_WindowPtr = (APTR)-1;

                        img->obj = NewDTObject(spec,
                                DTA_GroupID          , GID_PICTURE,
                                PDTA_FreeSourceBitMap, TRUE,
                                OBP_Precision        , PRECISION_EXACT,
                                PDTA_DestMode        , MODE_V43,
                                PDTA_UseFriendBitMap , TRUE,
                                PDTA_Screen          , mri->mri_Screen,
                                TAG_DONE);

                        myproc->pr_WindowPtr = oldwindowptr;

                        if (img->obj)
                        {
                                struct FrameInfo fri = {NULL};

                                DoMethod(img->obj,DTM_FRAMEBOX,NULL,&fri,&fri,sizeof(struct FrameInfo),0);

                                if (fri.fri_Dimensions.Depth>0)
                                {
                                        if (DoMethod(img->obj,DTM_PROCLAYOUT,NULL,1))
                                        {
                                                struct BitMapHeader *bmhd;

                                                get(img->obj,PDTA_BitMapHeader,&bmhd);

                                                GetDTAttrs(img->obj,PDTA_DestBitMap,&img->bitmap,TAG_DONE);

                                                if (!img->bitmap)
                                                        GetDTAttrs(img->obj,PDTA_BitMap,&img->bitmap,TAG_DONE);

                                                /* bitmap is in img->bitmap */

                                                return(img);
                                        }
                                        else D(DBF_IMAGE,bug("no dtm_proclayout\n"));
                                }
                                else D(DBF_IMAGE,bug("wrong depth %ld\n",fri.fri_Dimensions.Depth));

                                DisposeDTObject(img->obj);
                        }
                        FreeImage(img);
                }
                CloseLibrary(DataTypesBase);
        }
        return(NULL);
}

--
Greetings, Stefan


From: "Stefan Stuntz" 
Date:   Sun, 07 Apr 1996 13:20:29 +0100
X-Mailer: IntuiNews 1.3b Beta 7 (2.2.96)
Subject: Re: Datatypes vs. MUI_Bitmap
Message-Id: <81320957@magic.informatik.tu-muenchen.de>
Organization: Home of MUI
Resent-Message-Id: <"fRm9O1.0.7T4.nKwPn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/959
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 4123
X-Lines: 154
Status: RO

Hans Henrik Happe wrote

> Is the remaping rutine in MUI_Bitmap better than the one in the
> picture.datatype?

I doubt that.

> I found out that MUI_Bitmap gives better result even better than the new
> picture.datatype (V43) there is on the AmiNet.

Well, this might depend on the precision value you use for remapping.
However, the V43 datatypes is always preferable since it doesnt to
remapping on well-equipped (==cybergfx hi/truecolor) systems at all.

> Is it posible to make Datatype do its layout in a MUI window just like the
> ColorWheel.gadget can with a MUI_Boopsi class?

You can perfectly use datatypes for everything you want in MUI windows.
Here's the code I use to handle datatype images, you might want to
do something similar.

--
Greetings, Stefan




All this stuff is a bit MUIized, but you should get the idea of what to
do. As a result, img->bitmap contains a pointer to the bitmap of the
datatype image. This bitmap might not be a struct BitMap * but something
else depending on the display environment. Read autodocs auf 3.x
AllocBitMap() for more info.

You can e.g. wrap this whole stuff into a subclass of area class and
do the create/kill during setup/cleanup.


#include 

static VOID __asm KillAlienImage(_a0 struct AlienImage *img)
{
        struct Library *DataTypesBase = img->datatypesbase;
        DisposeDTObject(img->obj);
        FreeImage(img);
        CloseLibrary(DataTypesBase);
}

static struct MUI_Image *CreateAlienImage(struct MUI_RenderInfo *mri,char *spec,ULONG flags)
{
        struct AlienImage *img;
        struct Library *DataTypesBase;
        BOOL remap = TRUE;

        #ifdef MYDEBUG
        if (strstr(spec,"noremap"))
                remap = FALSE;
        #endif

        #ifdef MYDEBUG
        if (!strnicmp(spec,"sys:test",8))
                remap = FALSE;
        #endif

        D(DBF_IMAGE,bug("%s\n",spec));

        if (DataTypesBase = OpenLibrary("datatypes.library",39))
        {
                if (img = AllocImage(sizeof(struct AlienImage),spec))
                {
                        struct Process *myproc = (struct Process *)FindTask(NULL);
                        APTR oldwindowptr = myproc->pr_WindowPtr;

                        img->i.si = mri->mri_ScreenInfo;

                        myproc->pr_WindowPtr = (APTR)-1;

                        D(DBF_IMAGE,bug("vor NewDTObject() %s screen=%08lx\n",spec,mri->mri_Screen));

                        img->obj = NewDTObject(spec,
                                DTA_GroupID          , GID_PICTURE,
                                PDTA_FreeSourceBitMap, TRUE,
                                OBP_Precision        , PRECISION_EXACT,
                                PDTA_DestMode        , MODE_V43,
                                PDTA_UseFriendBitMap , TRUE,
                                PDTA_Screen          , mri->mri_Screen,
                                remap ? TAG_IGNORE : PDTA_Remap, FALSE,
                                TAG_DONE);

                        myproc->pr_WindowPtr = oldwindowptr;

                        if (img->obj)
                        {
                                struct FrameInfo fri = {NULL};

                                D(DBF_IMAGE,bug("vor FrameBox %s\n",spec));

                                DoMethod(img->obj,DTM_FRAMEBOX,NULL,&fri,&fri,sizeof(struct FrameInfo),0);

                                if (fri.fri_Dimensions.Depth>0)
                                {
                                        D(DBF_IMAGE,bug("vor ProcLayout %s\n",spec));

                                        if (DoMethod(img->obj,DTM_PROCLAYOUT,NULL,1))
                                        {
                                                struct BitMapHeader *bmhd;

                                                get(img->obj,PDTA_BitMapHeader,&bmhd);

                                                GetDTAttrs(img->obj,PDTA_DestBitMap,&img->bitmap,TAG_DONE);

                                                if (!img->bitmap)
                                                {
                                                        D(DBF_IMAGE,bug("no destbitmap, using source %s\n",spec));
                                                        GetDTAttrs(img->obj,PDTA_BitMap,&img->bitmap,TAG_DONE);
                                                }

                                                img->i.defwidth  = bmhd->bmh_Width;
                                                img->i.defheight = bmhd->bmh_Height;
                                                img->i.minwidth  = 0;
                                                img->i.minheight = 0;
                                                img->i.maxwidth  = MUI_MAXMAX;
                                                img->i.maxheight = MUI_MAXMAX;
                                                img->i.DrawFunc  = (APTR)DrawAlienImage;
                                                img->i.KillFunc  = (APTR)KillAlienImage;
                                                img->i.flags     = IMGTYPE_ALIEN;
                                                img->i.spec      = (char *)(((ULONG)img)+sizeof(struct AlienImage));

                                                img->datatypesbase = DataTypesBase;

                                                D(DBF_IMAGE,bug("bitmap=%08lx %s\n",img->bitmap,spec));

                                                if (img->bitmap)
                                                {
                                                }
                                                else D(DBF_IMAGE,bug("no bitmap\n"));

                                                D(DBF_IMAGE,bug("alien ok at %08lx\n",img));

                                                return(img);
                                        }
                                        else D(DBF_IMAGE,bug("no dtm_proclayout\n"));
                                }
                                else D(DBF_IMAGE,bug("wrong depth %ld\n",fri.fri_Dimensions.Depth));

                                DisposeDTObject(img->obj);
                        }
                        FreeImage(img);
                }
                CloseLibrary(DataTypesBase);
        }
        return(NULL);
}


From: ccc6004@cybercity.dk (Hans Henrik Happe)
To: mui@sunsite.Informatik.RWTH-Aachen.DE (Marcel Jantz)
Date: Tue, 09 Apr 1996 22:58:01
Message-Id: 
In-Reply-To: <1105.6673T736T2213@public.ndh.com>
X-Mailer: YAM 1.2 by Marcel Beck
Subject: Re: Datatypes vs. MUI_Bitmap
Resent-Message-Id: <"NSbXe3.0.iN2.LOjQn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/991
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 1053
X-Lines: 33
Status: RO

On 09-Apr-96, Marcel Jantz wrote:

> Is there a way to get MUI to draw a DataType-image only ones (not to tile
> it if the MUI-object is wider than the bitmap) ? A centering would be nice.

Well, you could make an Image or Bitmap object with no frame and then put it
in a Group. You could then make the Group do all the centering, framing and
pehaps RelVerify'ing.

btw. I'm currently working on a MUI custom class that uses datatypes to
read image data. Currently its only form my own work centering is one of
the features. The other is:

    Scaling like MUI vector objects (This is finished).
    Scrolling.
    (Maybee animation).

I'm making this for a ToolManager like program, but I don't know how far I'll
will get (cause' damn! - its a lot of fun makin MUI custom classes 8).

If anyone got any suggestions to such an DTScale class (deep under cover name :)
the feel free to attac my mail address!


     Hans Henrik Happe


EMail:           ccc6004@cybercity.dk
FidoNet:         2:238/127.9@fidonet
AmiNet:          39:140/136.9@aminet


From: "Stefan Stuntz" 
Date:   Wed, 10 Apr 1996 10:28:59 +0100
X-Mailer: IntuiNews 1.3b Beta 7 (2.2.96)
Subject: Re: Datatypes vs. MUI_Bitmap
Message-Id: <81321034@magic.informatik.tu-muenchen.de>
Organization: Home of MUI
Resent-Message-Id: <"i0ilS.0.QV4.t5tQn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/994
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 1044
X-Lines: 29
Status: RO

Hans Henrik Happe wrote

> >           myproc->pr_WindowPtr = (APTR)-1;
> >
> >           img->obj = NewDTObject(spec,
> >               DTA_GroupID          , GID_PICTURE,
> >               PDTA_FreeSourceBitMap, TRUE,
> >               OBP_Precision        , PRECISION_EXACT,
> >               PDTA_DestMode        , MODE_V43,
> >               PDTA_UseFriendBitMap , TRUE,
> >               PDTA_Screen          , mri->mri_Screen,
> >               remap ? TAG_IGNORE : PDTA_Remap, FALSE,
> >               TAG_DONE);
> >
> >           myproc->pr_WindowPtr = oldwindowptr;
>
> [... and more code]
>
> Why this changing the WindowPtr in the Process? Do datatypes use it?

Well, datatypes read files and so they might come up with "Please insert
volume ..." requesters. I prevent this for MUI background images because
they are not really necessary to run an application. It doesnt make
sense to bother a user with (maybe tons of) these requesters just
because his background picture directory is currently unavailable.

--
Greetings, Stefan

From: nightspeed@ids.net (John Tyler)
Date: May 11 1996 10:44:52 PM
To: mui@sunsite.Informatik.RWTH-Aachen.DE
Subject: A stupid question...
Organization: NightSpeed ProductionsX-Mailer: Air Mail V3.2 -- Amiga Mailer by Danny Y. Wong
Resent-Message-Id: <"k9la.0.e-.DjKbn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/1272
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 749
X-Lines: 22
Status: RO

As some of you know I've been working on a new datatype 
system to be used from within MUI. One of the classes in 
this system distributes pre-parsed data from a file to it's 
member objects and recovers the data after editing for 
return to the datatype.

Problem is: I don't know what to call it.

During development I've called it "container" class, but 
"container" seems to me to be a rather lengthy word, and 
typing "ContainerObject" over and over, everytime you need 
one seems a bit excessive. (Aren't you glad you only need 
one "Application" object in an MUI app?)

Can anyone suggest a word < 6 characters that implies the 
function of this class???

                Thanx
                John Tyler
                nightspeed@ids.net


Subject: Re: More damn Bitmap troubles...
Resent-Message-Id: <"HBLv8.0.LH6.Sq9gn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/1404
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 1322
X-Lines: 43
Status: RO

On 26-May-96, John Tyler wrote:

> I have on major problem with bitmap class. After much 
> experimentation I have finally managed to load an image 
> from a datatype into a bitmap object.
> 
> Now I can't figure out how to get the bitmap to remap the 
> image to my screen. I get VERY strange colors.
> 
> So:
>     1) How can I reliably obtain that very wierd 32 
>        bit per gun, per color, per entry array? Not 
>        all image datatypes return CMAPs!

Get the PDTA_CRegs from the datatype and put it in MUIA_Bitmap_SourceColors.
Get the PDTA_Bitmap from the datatype and put it in MUIA_Bitmap_Bitmap.

>     2) How do i order the bitmap to remap once I give it 
>        the array it needs.

Just open the Window containing the Bitmap object.

>     3) Why the #@%^& isn't there any example code for how 
>        to use these bitmaps. (Maybe I'm missing some hidden
>        example somewhere...)

???

btw. If you want to use the MUIA_Bitmap_Transparent feature you can't not
use datatypes bitmap directly because it in most cases are interleaved and
there is a bug in the Bitmap class that gives a bad result when using interleaved
bitmaps. Stefan knows about this!


     Hans Henrik Happe

--
EMail:           HHH@cybercity.dk
FidoNet:         2:238/127.9@fidonet
AmiNet:          39:140/136.9@aminet

Subject: Re: More damn Bitmap troubles (redux)
Organization: NightSpeed ProductionsX-Mailer: Air Mail V3.2 -- Amiga Mailer by Danny Y. Wong
Resent-Message-Id: <"pXZGd3.0.d83.kbXgn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/1415
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 1697
X-Lines: 53
Status: RO

On 'Sun, 26 May 1996 14:27:26' you wrote:

> On 26-May-96, John Tyler wrote:
> 
> > I have on major problem with bitmap class. After much 
> > experimentation I have finally managed to load an image 
> > from a datatype into a bitmap object.
> > 
> > Now I can't figure out how to get the bitmap to remap the 
> > image to my screen. I get VERY strange colors.
> > 
> > So:
> >     1) How can I reliably obtain that very wierd 32 
> >        bit per gun, per color, per entry array? Not 
> >        all image datatypes return CMAPs!
> 

On 'Sun, 26 May 1996 14:27:26' you replied:
> Get the PDTA_CRegs from the datatype and put it in MUIA_Bitmap_SourceColors.
> Get the PDTA_Bitmap from the datatype and put it in MUIA_Bitmap_Bitmap.
That works great on the GIF and TIFF datatypes, but not with 
the JPEG, JFIF, and ILBM. For these, that don't work, I need 
to get PDTA_ColorRegisters; I don't know why, and I don't 
have the datatype autodocs!

Any idea how I can check which is the correct one to 
get/use?

I've tried the following (which doesn't work):

   if (!get (data->defbitmapDT, PDTA_ColorRegisters, &colreg))
      {
      get (data->defbitmapDT, PDTA_CRegs, &colreg)
      }

Any ideas???


> >     2) How do i order the bitmap to remap once I give it 
> >        the array it needs.
> 
> Just open the Window containing the Bitmap object.

Understood. I needed to figure out where the window was 
opened in my custom class and put my initialization code 
(set MUIA_Bitmap_Bitmap, for example) before the DoSuper. 
Previously I had it after the DoSuper... stupid me!

                        Thanks,
                        John HLB Tyler
                        nightspeed@ids.net